package com.yy.rabbitmq.controller;

import com.yy.rabbitmq.service.ISmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping(value = "/message")
public class MessageController {


    @Autowired
    private ISmsService smsService;

    @Autowired
    private ISmsService phoneService;

    @GetMapping(value = "/sendEmail")
    public String sendEmailMessage(String message){
        this.smsService.sendEmailMessage(message);
        System.out.println(new Date()+"发送时间");
        return "发送邮件消息成功";
    }

    @GetMapping(value = "/sendPhone")
    public String sendPhoneMessage(String message){
        this.smsService.sendPhoneMessage(message);
        return "发送电话消息成功";
    }
}
